home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2004 April / SGI IRIX 6.5 Applications 2004 April.iso / dist / sgimeeting.idb / usr / bin / X11 / sgimeeting.z / sgimeeting
Text File  |  2003-09-23  |  6KB  |  185 lines

  1. #!/bin/sh
  2. #Tag 0x0001064C
  3. #
  4. #       Add Path:  Add to the path variable named by $1 the component $2.  $3
  5. #       must be "append" or "prepend" to indicate where the component is added.
  6. #
  7. addpath () {
  8.     eval value=\"\$$1\"
  9.     case "$value" in
  10.         *:$2:*|*:$2|$2:*|$2)
  11.             result="$value"
  12.             ;;
  13.         "")
  14.             result="$2"
  15.             ;;
  16.         *)
  17.             case "$3" in
  18.                 p*)
  19.                     result="$2:${value}"
  20.                     ;;
  21.                 *)
  22.                     result="${value}:$2"
  23.                     ;;
  24.             esac
  25.     esac
  26.     eval $1=$result
  27.     unset result value
  28. }
  29.  
  30. #
  31. #       Create a directory for received files in the user's home directory
  32. #       and mention it in the config file
  33. #
  34.  
  35. SetRcvDir() {
  36.         if [ -d ${HOME}/.sgimeeting-rcv-files ]; then
  37.             if [ -w ${HOME}/.sgimeeting-rcv-files ]; then
  38.                 # directory exists and is writable - use it
  39.                 echo "Command Centre.ReceiveDir: ${HOME}/.sgimeeting-rcv-files" >> ${HOME}/.sgimeeting
  40.             else
  41.                 # directory exists but is not writable - go to /tmp
  42.                 echo "Command Centre.ReceiveDir: /tmp" >> ${HOME}/.sgimeeting
  43.             fi
  44.         else
  45.             # try to create the received files directory
  46.             mkdir ${HOME}/.sgimeeting-rcv-files
  47.  
  48.             if [ -d ${HOME}/.sgimeeting-rcv-files ]; then
  49.                 # we made the directory OK - use it
  50.                 echo "Command Centre.ReceiveDir: ${HOME}/.sgimeeting-rcv-files" >> ${HOME}/.sgimeeting
  51.             else
  52.                 # could not make the directory - go to /tmp
  53.                 echo "Command Centre.ReceiveDir: /tmp" >> ${HOME}/.sgimeeting
  54.             fi
  55.         fi
  56. }
  57.  
  58. #
  59. #       Update the users config file.  Grep out the useful information
  60. #
  61.  
  62. UpdateConfig() {
  63.         mv ${HOME}/.sgimeeting /tmp/.sgimeeting
  64.         echo "VERSION: $CURVERSION"                >  ${HOME}/.sgimeeting
  65.         grep "Command Centre"     /tmp/.sgimeeting | grep -v "ReceiveDir" >> ${HOME}/.sgimeeting
  66.         grep "Site Name"          /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  67.         grep "Message"            /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  68.         grep "Whiteboard.Left"    /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  69.         grep "Whiteboard.Top"     /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  70.         grep "Whiteboard.Width"   /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  71.         grep "Whiteboard.Height"  /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  72.         grep "Whiteboard.Printer" /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  73.         grep "Whiteboard.GSPath"  /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  74.         grep "Whiteboard.SgiPktRecLength"  /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  75.  
  76.         # if there is an existing receive dir entry, and
  77.         # if it is NOT the home directory, move it across to
  78.         # the updated config file
  79.         needToSetRcv="TRUE"
  80.         rdEntry=`grep "Command Centre.ReceiveDir" /tmp/.sgimeeting`
  81.         if [ "$rdEntry" != "" ]; then
  82.             rdir=`echo $rdEntry | sed 's/ *Command Centre.ReceiveDir *: *//'`
  83.             if [ "$rdir" != "$HOME" ]; then
  84.                 grep "Command Centre.ReceiveDir"  /tmp/.sgimeeting >> ${HOME}/.sgimeeting
  85.                 needToSetRcv="FALSE"
  86.             fi
  87.         fi
  88.  
  89.         rm /tmp/.sgimeeting
  90.  
  91.         # Now we have the config file in place, set the receive directory
  92.         # if necessary
  93.         if [ "$needToSetRcv" = "TRUE" ]; then
  94.             SetRcvDir
  95.         fi
  96. }
  97.  
  98. usage () {
  99.     if [ $1 = nopath ]; then
  100.         echo "Cannot find path for SGImeeting - Please check installation"
  101.     elif [ $1 = help ]; then
  102.         echo "usage: sgimeeting [options]"
  103.         echo
  104.         echo "    options: -visual 0xnn"
  105.         echo "               use visual 0xnn for shadow windows"
  106.         echo "             -install"
  107.         echo "               install a private colormap using visual specified"
  108.         echo "             -noinstall"
  109.         echo "               do not install a private colormap"
  110.         echo "             -runinbackground"
  111.         echo "               start running in the background"
  112.         echo "             -speeddial <filename>"
  113.         echo "               process the speed dial file <filename>"
  114.         echo
  115.         echo "    By default SGImeeting will use a 24bpp TrueColor visual if available."
  116.         echo "    If not the default visual and colormap are used."
  117.     fi
  118.     echo
  119. }
  120.  
  121. #
  122. #       Start of main script
  123. #
  124.  
  125. #
  126. #       Check if the user is asking for help and if so give it to them.
  127. #
  128.  
  129. if [ .$1 = ".-help" ]; then
  130.     echo
  131.     usage help
  132.     exit 1
  133. fi
  134.  
  135. #
  136. #       Check to see if this is the first time in. If so we want to run
  137. #       ourselves in the background.
  138. #
  139.  
  140. if [ .$1 != ".bg" ]; then
  141.     $0 bg "$@" &
  142.     exit 0
  143. fi
  144.  
  145. #
  146. #       Determine if the user has a config file which is for an earlier
  147. #       version of the product.  If so, update it
  148. #
  149. #       If there's no config file then create a new one, stamped with
  150. #       the correct version number.
  151. #
  152.  
  153. CURVERSION=`awk '/VERSION/ {print $2}' /usr/SGImeeting/config/sgimeeting`
  154. if [ -f ${HOME}/.sgimeeting ]; then
  155.     OLDVERSION=`awk '/VERSION/ {print $2}' ${HOME}/.sgimeeting`
  156.     if [ -n "$CURVERSION" ]; then
  157.         if [ -z "$OLDVERSION" ]; then
  158.             UpdateConfig
  159.         elif [ $OLDVERSION -lt $CURVERSION ]; then
  160.             UpdateConfig
  161.         fi
  162.     fi
  163. else
  164.     echo "VERSION: $CURVERSION"          >  ${HOME}/.sgimeeting
  165.     SetRcvDir
  166. fi
  167.  
  168. #
  169. #       Record the current directory in case we change to another
  170. #       directory below.
  171. #
  172.  
  173. export DCS_ORIG_PWD=`pwd`
  174.  
  175.  
  176. #
  177. # Configuration-specific locations.
  178. #
  179. # run ./bin/sgim_cc followed by ./bin/t120_d
  180. cd /usr/SGImeeting
  181. ./bin/sgim_cc "$@"
  182. if [ $? -ne 255 ]; then
  183.     ./bin/t120_d x > /dev/null
  184. fi
  185.